//762. 二进制表示中质数个计算置位
//思路：将二进制序列1的个数与素数判断结合

#include <math.h>
int isPrime(int n){
    int count = 0;
    while(n)
    {
        int tmp = n % 2;
        if(tmp & 1 == 1)
            count++;
        n /= 2;
    }
    if(count < 2)
        return 0;
    for(int i = 2; i <= sqrt(count); i++)
    {
        if(count % i == 0)
            return 0;
    }
    return 1;
}
int countPrimeSetBits(int left, int right){
    int count = 0;
    for(int i = left; i <= right; i++)
    {
        if(1 == isPrime(i))
            count++;
    }
    return count;
}